package com.grt.condify.reflect;

import com.grt.condify.utils.StringUtil;

import java.lang.annotation.Annotation;
import java.util.List;

/**
 * Created by cy on 16/6/2.
 */
public class Class2AnnotationInNonStaticCache extends Class2MapInNonStaticCache<String, Class<? extends Annotation>, List<String>> {

    @Override
    public boolean isKeyEmpty(String key) {
        return StringUtil.isEmpty(key);
    }

    @Override
    public boolean isKeyOfMapEmpty(Class<? extends Annotation> keyOfMap) {
        return keyOfMap == null;
    }

    @Override
    public boolean isValueIsEmpty(List<String> value) {
        return value == null || value.size() <= 0;
    }

    public List<String> getFieldsWithAnnotation(String className, Class<? extends Annotation> annotationClass) {
        if (StringUtil.isEmpty(className) || annotationClass == null) {
            return null;
        }
        return isContain(className) ? firstLevelCaches.get(className).get(annotationClass) : null;
    }
}
